package pers.qianyu.module.security.holder;

import pers.qianyu.module.security.domain.*;

/**
 * @author mizzle rain
 * @date 2021-03-13 21:00
 */
public class CurrentLoginUserHolder {
    private static final ThreadLocal<LoginUser> LOGIN_USER_THREAD_LOCAL = new ThreadLocal<>();

    public static void setLoginUser(LoginUser loginUser) {
        LOGIN_USER_THREAD_LOCAL.set(loginUser);
    }

    public static LoginUser getLoginUser() {
        return LOGIN_USER_THREAD_LOCAL.get();
    }

    public static void clear() {
        LOGIN_USER_THREAD_LOCAL.remove();
    }
}
